﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _4mvcBlog.Core.ViewEngine
{
    /// <summary>
    /// 后台管理ViewEngine
    /// </summary>
    public class AdminViewEngine : VirtualPathProviderViewEngine
    {
        public AdminViewEngine()
        {
            base.MasterLocationFormats = new[] {
                "~/Views/Admin/Admin_{0}.master",
                "~/Views/Admin/Shared/Admin_{0}.master"
            };

            base.ViewLocationFormats = new[] {
                "~/Views/Admin/Admin_{0}.aspx",
                "~/Views/Admin/Admin_{0}.ascx",
                "~/Views/Admin/Shared/Admin_{0}.aspx",
                "~/Views/Admin/Shared/Admin_{0}.ascx"
            };

            base.PartialViewLocationFormats = base.ViewLocationFormats;
        }

        protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) {
            return new WebFormView(partialPath);
        }

        protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) {
            return new WebFormView(viewPath, masterPath);
        }
    }
}
